package com.koomii.redis.demo.message.sender;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class DemoRedisSender {
	@Autowired
	RedisTemplate<String, String> redisTemplate;
	
	public void send(String topic,String message) {
		long start = System.currentTimeMillis();
		redisTemplate.convertAndSend(topic, message);
		System.out.println("发送消息耗时："+(System.currentTimeMillis() - start)+"ms");
	}
}